# eric7.MicroPython.MicroPythonWindow

Module implementing the standalone MicroPython window.

### Global Attributes

SslAvailable

### Classes

MicroPythonWindow | Class implementing the standalone MicroPython window.

### Functions

None

## MicroPythonWindow

Class implementing the standalone MicroPython window.

### Signals

editorCountChanged(count)
  emitted whenever the count of open editors changed
preferencesChanged()
  emitted after the preferences were changed
shutdown()
  emitted to indicate a shutdown of the application

### Derived from

EricMainWindow

### Class Attributes

None

### Class Methods

None

### Methods

MicroPythonWindow | Constructor
__appFocusChanged | Private slot to track the application focus.
__deviceDisconnect | Private slot handling the device being disconnected.
__editorClosing | Private method called, when an editor is closing.
__preferencesChanged | Private slot to handle a change of the preferences.
__sslErrors | Private slot to handle SSL errors.
activeWindow | Public method to get a reference to the active editor.
addSideWidget | Public method to add a widget to the sides.
closeEvent | Protected event handler for the close event.
getEditor | Public method to return the editor displaying the given file.
getOpenEditorsCount | Public method to get the number of open editors.
launchHelpViewer | Public slot to start the help viewer/web browser.
networkAccessManager | Public method to get a reference to the network access manager object.
newEditorWithText | Public method to generate a new editor with a given text and associated file name.
removeSideWidget | Public method to remove a widget added using addSideWidget().
showPreferences | Public slot to set the preferences.
showSideWidget | Public method to show a specific widget placed in the side widgets.

### Static Methods

None

#### MicroPythonWindow (Constructor)

MicroPythonWindow(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### MicroPythonWindow.__appFocusChanged

__appFocusChanged(_old, now)

Private slot to track the application focus.

_old (QWidget)
  reference to the widget loosing focus (unused)
now (QWidget)
  reference to the widget gaining focus

#### MicroPythonWindow.__deviceDisconnect

__deviceDisconnect()

Private slot handling the device being disconnected.

This closes all editors directly connected to the device about to be disconnected.

#### MicroPythonWindow.__editorClosing

__editorClosing(editor)

Private method called, when an editor is closing.

editor (MiniEditor)
  reference to the closing editor

#### MicroPythonWindow.__preferencesChanged

__preferencesChanged()

Private slot to handle a change of the preferences.

#### MicroPythonWindow.__sslErrors

__sslErrors(reply, errors)

Private slot to handle SSL errors.

reply (QNetworkReply)
  reference to the reply object
errors (list of QSslError)
  list of SSL errors

#### MicroPythonWindow.activeWindow

activeWindow()

Public method to get a reference to the active editor.

Return:
  reference to the active editor

Return Type:
  MiniEditor

#### MicroPythonWindow.addSideWidget

addSideWidget(_side, widget, icon, label, )

Public method to add a widget to the sides.

_side (UserInterfaceSide)
  side to add the widget to (unused)
widget (QWidget)
  reference to the widget to add
icon (QIcon)
  icon to be used
label (str)
  label text to be shown

#### MicroPythonWindow.closeEvent

closeEvent(evt)

Protected event handler for the close event.

evt (QCloseEvent)
  reference to the close event
  This event is simply accepted after the history has been saved and all window references have been deleted.

#### MicroPythonWindow.getEditor

getEditor(fn)

Public method to return the editor displaying the given file.

fn (str)
  filename to look for

#### MicroPythonWindow.getOpenEditorsCount

getOpenEditorsCount()

Public method to get the number of open editors.

Return:
  number of open editors

Return Type:
  int

#### MicroPythonWindow.launchHelpViewer

launchHelpViewer(url)

Public slot to start the help viewer/web browser.

url (str or QUrl)
  URL to be opened

#### MicroPythonWindow.networkAccessManager

networkAccessManager()

Public method to get a reference to the network access manager object.

Return:
  reference to the network access manager object

Return Type:
  QNetworkAccessManager

#### MicroPythonWindow.newEditorWithText

newEditorWithText(text, language="", fileName="")

Public method to generate a new editor with a given text and associated file name.

text (str)
  text for the editor
language (str (optional))
  source language (defaults to "")
fileName (str (optional))
  associated file name (defaults to "")

#### MicroPythonWindow.removeSideWidget

removeSideWidget(widget)

Public method to remove a widget added using addSideWidget().

widget (QWidget)
  reference to the widget to remove

#### MicroPythonWindow.showPreferences

showPreferences(pageName=None)

Public slot to set the preferences.

pageName (str)
  name of the configuration page to show

#### MicroPythonWindow.showSideWidget

showSideWidget(widget)

Public method to show a specific widget placed in the side widgets.

widget (QWidget)
  reference to the widget to be shown

Up